package com.struts.service.impl;

import java.io.Serializable;
import java.util.List;

import com.struts.dao.UserDao;
import com.struts.dao.impl.UserDaoImpl;
import com.struts.pojo.User;
import com.struts.service.UserService;

public class UserServiceImpl implements UserService {
	
	private UserDao userDao = new UserDaoImpl() ;

	public List<User> getAllUser() {
		List<User> userList = userDao.getAllUser() ;
		return userList;
	}

	public User getUserById(Serializable id) {
		User user = userDao.getUserById(id) ;
		return user;
	}

	public void saveUser(User user) {
		userDao.saveUser(user) ;
	}

	public void deleteUser(Serializable id) {
		userDao.deleteUser(id) ;
	}

	public void updateUser(User user) {
		userDao.updateUser(user) ;
	}

	public User login(String username, String password) {
		User user = userDao.getUserByUsernameAndPassword(username, password) ;
		return user;
	}

}
